package com.zut.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zut.dao.OrderPractiseDao;
import com.zut.domain.OrderPractise;
import com.zut.domain.Student;
import com.zut.service.OrderPractiseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class OrderPractiseServiceImpl implements OrderPractiseService {
    @Autowired
    private OrderPractiseDao orderPractiseDao;


    public PageInfo<OrderPractise> getAll(Integer pageNum, Integer pageSize) {
        List<OrderPractise> list;
        PageHelper.startPage(pageNum, pageSize);
        list = orderPractiseDao.getAll();
        return new PageInfo<>(list);
    }

    public boolean insert(OrderPractise orderPractise) {
        return orderPractiseDao.insert(orderPractise) > 0;
    }

    public boolean delete(String id) {
        return orderPractiseDao.delete(id) > 0;
    }

    public boolean update(OrderPractise orderPractise) {
        return orderPractiseDao.update(orderPractise) > 0;
    }

    public PageInfo<OrderPractise> reserved(Integer pageNum, Integer pageSize) {
        List<OrderPractise> list;
        PageHelper.startPage(pageNum, pageSize);
        list = orderPractiseDao.reserved();
        return new PageInfo<>(list);
    }

    public PageInfo<Map<String, String>> getById(Integer pageNum, Integer pageSize, String id) {
        List<Map<String, String>> list;
        PageHelper.startPage(pageNum, pageSize);
        list = orderPractiseDao.getById(id);
        return new PageInfo<>(list);
    }

    public PageInfo<Map<String, String>> reservedMsg(Integer pageNum, Integer pageSize, String place) {
        List<Map<String, String>> list;
        PageHelper.startPage(pageNum, pageSize);
        list = orderPractiseDao.reservedMsg(place);
        return new PageInfo<>(list);

    }

}
